home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu248.dms / pu248.adf / Intuition / Miscellaneous / Example3.c < prev    next >
C/C++ Source or Header  |  1992-05-01  |  2KB  |  74 lines

  1. /***********************************************************/
  2. /*                                                         */
  3. /* Amiga C Encyclopedia (ACE) V3.0      Amiga C Club (ACC) */
  4. /* -------------------------------      ------------------ */
  5. /*                                                         */
  6. /* Book:    ACM Intuition               Amiga C Club       */
  7. /* Chapter: Miscellaneous               Tulevagen 22       */
  8. /* File:    Example3.c                  181 41  LIDINGO    */
  9. /* Author:  Anders Bjerin               SWEDEN             */
  10. /* Date:    92-05-01                                       */
  11. /* Version: 1.10                                           */
  12. /*                                                         */
  13. /*   Copyright 1992, Anders Bjerin - Amiga C Club (ACC)    */
  14. /*                                                         */
  15. /* Registered members may use this program freely in their */
  16. /*     own commercial/noncommercial programs/articles.     */
  17. /*                                                         */
  18. /***********************************************************/
  19.  
  20. /* This example shows how to get a copy of the preferences. */
  21.  
  22.  
  23. #include <intuition/intuition.h>
  24.  
  25.  
  26.  
  27. struct IntuitionBase *IntuitionBase;
  28.  
  29.  
  30.  
  31. main()
  32. {
  33.   /* Declare a preferences structure: */
  34.   struct Preferences pref;
  35.  
  36.  
  37.  
  38.   /* Open the Intuition Library: */
  39.   IntuitionBase = (struct IntuitionBase *)
  40.     OpenLibrary( "intuition.library", 0 );
  41.   
  42.   if( IntuitionBase == NULL )
  43.     exit(); /* Could NOT open the Intuition Library! */
  44.  
  45.  
  46.  
  47.   /* Try to get a copy of the current preferences (whole): */
  48.   if( GetPrefs( &pref, sizeof(pref) ) == NULL )
  49.   {
  50.     /* Could not get a copy of the preferences! */
  51.     CloseLibrary( IntuitionBase );
  52.     exit();
  53.   }
  54.  
  55.  
  56.  
  57.   /* We have now a copy of the preferences. */
  58.   /* Do what ever you want...               */
  59.  
  60.   /* Why not print out the workbench clours? */
  61.   printf( "\nWorkbench Screen Colours:\n");
  62.   printf( "             RGB\n" );
  63.   printf( "Colour 0: 0x%04x\n", pref.color0 );
  64.   printf( "Colour 1: 0x%04x\n", pref.color1 );
  65.   printf( "Colour 2: 0x%04x\n", pref.color2 );
  66.   printf( "Colour 3: 0x%04x\n\n", pref.color3 );
  67.  
  68.  
  69.  
  70.   /* Close the Intuition Library: */
  71.   CloseLibrary( IntuitionBase );
  72. }
  73.  
  74.